<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
     function doSearch() {
   		$('#dg').datagrid('options').pageNumber=1;//设置页码初始值为1
   	    $('#dg').datagrid({
   	        queryParams : $('#sform').serializeObject()
   	    });
	  }
     
   function editGzryYw(gid, wid, url) {
 		var row = $('#' + gid).datagrid('getSelected');
 		if (row != null) {
 			$('#' + wid).window('open');
 			$('#' + wid).window('refresh', url + '?id=' + row.dm);
 		} else {
 			$.messager.alert('警告', '请选择要修改的记录！');
 		}
   }
     
   function deleteGzryYw(gid, url) {
 		var row = $('#' + gid).datagrid('getSelected');
 		if (row != null) {
 			$.messager.confirm('确认', "确认删除吗？", function(r) {
 				if (r) {
 					$.ajax({
 						type : 'post',
 						url : url,
 						data : {
 							'id' : row.dm
 						},
 						dataType:'json',
 						success : function(data) {
 							if (data) {
 								if (data.ack_code == "SUCCESS") {
 									showMsg('提示', data.data);
 									if (gid && gid != '') {
 										$('#' + gid).datagrid({});
 									}
 								} else {
 									showMsg('提示', data.data);
 								}
 							} else {
 								showMsg('提示', '删除失败！');
 							}
 						}
 					})
 				}
 			})
 		} else {
 			$.messager.alert('警告', '请选择要删除的记录！');
 		}
 	}
   
   function batchDelGzryYw(gid, url) {
		var rows = $('#' + gid).datagrid('getSelections');
		var ids = "";
		for (var i = 0; i < rows.length; i++) {
			ids += rows[i].dm + ","
		};
		ids = ids.substr(0, ids.length - 1);
		if (ids != '') {
			$.messager.confirm('确认', "确认删除吗？", function(r) {
				if (r) {
					$.ajax({
						type : 'post',
						url : url,
						data : {
							'ids' : ids
						},
						success : function(data) {
							if (data) {
 								if (data.ack_code == "SUCCESS") {
 									showMsg('提示', data.data);
 									if (gid && gid != '') {
 										$('#' + gid).datagrid({});
 									}
 								} else {
 									showMsg('提示', data.data);
 								}
 							} else {
 								showMsg('提示', '批量删除失败！');
 							}
						}
					})
				}
			})
		} else {
			$.messager.alert('警告', '请选择要删除的记录！');
		}
	}
</script>
<title>关注人员列表</title>
</head>
<body style="margin:0;padding:0">
     <div id="cc" class="easyui-layout"  data-options="fit:true">
     <%--查询条件--%>
	<div id="tb" style="padding: 10px;">
        <form id="sform" method="post">
            <input name="wfds" id="wfds" class="easyui-searchbox" data-options="prompt:'关注人姓名,身份证号码,创建时间,是否注销...',searcher:doSearch" style="width:20%">
            <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="showWin('win','${ctx}/lsj/registration/showModify');">新增</a>
            <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editGzryYw('dg','win','${ctx}/lsj/registration/showModify');">修改</a>
            <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deleteGzryYw('dg','${ctx}/lsj/registration/delete')">删除</a>
            <a href="#" class="easyui-linkbutton" iconCls="icon-bdel" plain="true" onclick="batchDelGzryYw('dg','${ctx}/lsj/registration/batchDel')">批量删除</a>
            <a href="#" class="easyui-linkbutton" iconCls="icon-layup" plain="true" onclick="layupGzryYw('dg','${ctx}/lsj/registration/layup)">注销</a>
        </form>
	 	<div id="win" class="easyui-window" title="关注人员管理"
	        data-options="iconCls:'${icon}',collapsible:false,minimizable:false,maximizable:false,closed:true"
	        style="width: 600px; height: 350px; background-color: white;"></div>
    </div>
	 <%--查询条件--%>
	<%--查询结果列表--%>
		<table class="easyui-datagrid" id="dg" style="width: 100%; height: 100%; padding: 0px;"
	        data-options="
	                border:false,
	                rownumbers:true,
	                singleSelect:false,
	                autoRowHeight:false, 
	                pagination:true,
	                toolbar:'#tb',
	                url:'${ctx}/lsj/registration/search',
	                pageSize:20">
			<thead>
				<tr>
					<th data-options="field:'ck',checkbox:true"></th>
					<th field="id" hidden=true>id</th>
					<th field="xm" width="20%" align="center">关注人员姓名</th>
					<th field="zjhm" width="35%" align="center">关注人员证件号码</th>
					<th field="cjsj" width="30%" align="center">创建时间</th>
					<th field="sfzx" width="10%" align="center">是否注销</th>
				</tr>
			</thead>
		</table>
     	<%--查询结果列表完--%>   
    </div>
</body>
</html>
